﻿using EPiServer;
using EPiServer.DynamicContent;
using SocialPack.modules.SocialPack.Widgets.Linkedin;

namespace SocialPack.modules.SocialPack.DynamicContent.Linkedin
{
    [DynamicContentPlugIn(
        DisplayName = "Linkedin Member Profile",
        Description = "Displays Linkedin Member Profile",
        ViewUrl = "~/modules/socialpack/dynamiccontent/linkedin/MemberProfile.ascx")]
    public partial class MemberProfile : UserControlBase
    {
        public string PublicProfileUrl { get; set; }

        public Format DisplayMode { get; set; }

        public string Text { get; set; }

        public bool ShowConnections { get; set; }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!string.IsNullOrWhiteSpace(this.PublicProfileUrl))
            {
                this.MemberProfileControl.PublicProfileUrl = this.PublicProfileUrl;
            }

            this.MemberProfileControl.DisplayMode = this.DisplayMode;

            if (!string.IsNullOrWhiteSpace(this.Text))
            {
                this.MemberProfileControl.Text = this.Text;
            }

            this.MemberProfileControl.ShowConnections = this.ShowConnections;
        }
    }
}